$(document).ready(function () {
	$( "#PostGradeDialog" ).dialog({
			width: 500,
			height: 200,
			modal: true,
			buttons: {
						"Yes": function() {
						  MakeGradeVisible($(this).attr('testid'));
						  $( this ).dialog( "close" );
						  SubmitComplete();
						},
						"No": function() {
						  $( this ).dialog( "close" );
						  SubmitComplete();
						}
					  }
	});
});


function SubmitComplete()
{
	$( "#ConfirmDialog" ).dialog({
			width: 500,
			height: 120,
			modal: true,
	});

	setTimeout(function(){document.location = "main.php";} ,3000);
}

function MakeGradeVisible(TestRecID)
{
	$.ajax({
		 url: "webservices.php",
		 type: "POST",
		 data: { Func: 'make_grade_visible', TestRecordID: TestRecID },
		 dataType: 'json',
		 success: function (data) {

		 },
		 error: function (e)
		 {
			console.log(e);
		 }
	});
}